3.4.83 \(\int (a+a \cos (e+f x))^m (A+B \cos (e+f x)+C \cos ^2(e+f x)) \, dx\) [383]

3.4.83.1 Optimal result
3.4.83.2 Mathematica [C] (verified)
3.4.83.3 Rubi [A] (verified)
3.4.83.4 Maple [F]
3.4.83.5 Fricas [F]
3.4.83.6 Sympy [F]
3.4.83.7 Maxima [F]
3.4.83.8 Giac [F]
3.4.83.9 Mupad [F(-1)]

3.4.83.1 Optimal result

Integrand size = 33, antiderivative size = 183 \[ \int (a+a \cos (e+f x))^m \left (A+B \cos (e+f x)+C \cos ^2(e+f x)\right ) \, dx=-\frac {(C-B (2+m)) (a+a \cos (e+f x))^m \sin (e+f x)}{f (1+m) (2+m)}+\frac {C (a+a \cos (e+f x))^{1+m} \sin (e+f x)}{a f (2+m)}+\frac {2^{\frac {1}{2}+m} \left (B m (2+m)+C \left (1+m+m^2\right )+A \left (2+3 m+m^2\right )\right ) (1+\cos (e+f x))^{-\frac {1}{2}-m} (a+a \cos (e+f x))^m \operatorname {Hypergeometric2F1}\left (\frac {1}{2},\frac {1}{2}-m,\frac {3}{2},\frac {1}{2} (1-\cos (e+f x))\right ) \sin (e+f x)}{f (1+m) (2+m)} \]

output
-(C-B*(2+m))*(a+a*cos(f*x+e))^m*sin(f*x+e)/f/(1+m)/(2+m)+C*(a+a*cos(f*x+e) 
)^(1+m)*sin(f*x+e)/a/f/(2+m)+2^(1/2+m)*(B*m*(2+m)+C*(m^2+m+1)+A*(m^2+3*m+2 
))*(1+cos(f*x+e))^(-1/2-m)*(a+a*cos(f*x+e))^m*hypergeom([1/2, 1/2-m],[3/2] 
,1/2-1/2*cos(f*x+e))*sin(f*x+e)/f/(m^2+3*m+2)
 
3.4.83.2 Mathematica [C] (verified)

Result contains complex when optimal does not.

Time = 1.92 (sec) , antiderivative size = 376, normalized size of antiderivative = 2.05 \[ \int (a+a \cos (e+f x))^m \left (A+B \cos (e+f x)+C \cos ^2(e+f x)\right ) \, dx=\frac {i 4^{-1-m} e^{i f m x} \left (1+e^{i (e+f x)}\right )^{-2 m} \left (e^{-\frac {1}{2} i (e+f x)} \left (1+e^{i (e+f x)}\right )\right )^{2 m} \cos ^{-2 m}\left (\frac {1}{2} (e+f x)\right ) (a (1+\cos (e+f x)))^m \left (\frac {C e^{-i (2 e+f (2+m) x)} \operatorname {Hypergeometric2F1}\left (-2-m,-2 m,-1-m,-e^{i (e+f x)}\right )}{2+m}+\frac {2 B e^{-i (e+f (1+m) x)} \operatorname {Hypergeometric2F1}\left (-1-m,-2 m,-m,-e^{i (e+f x)}\right )}{1+m}+\frac {2 B e^{i (e-f (-1+m) x)} \operatorname {Hypergeometric2F1}\left (1-m,-2 m,2-m,-e^{i (e+f x)}\right )}{-1+m}+\frac {C e^{2 i e-i f (-2+m) x} \operatorname {Hypergeometric2F1}\left (2-m,-2 m,3-m,-e^{i (e+f x)}\right )}{-2+m}+\frac {4 A e^{-i f m x} \operatorname {Hypergeometric2F1}\left (-2 m,-m,1-m,-e^{i (e+f x)}\right )}{m}+\frac {2 C e^{-i f m x} \operatorname {Hypergeometric2F1}\left (-2 m,-m,1-m,-e^{i (e+f x)}\right )}{m}\right )}{f} \]

input
Integrate[(a + a*Cos[e + f*x])^m*(A + B*Cos[e + f*x] + C*Cos[e + f*x]^2),x 
]
 
output
(I*4^(-1 - m)*E^(I*f*m*x)*((1 + E^(I*(e + f*x)))/E^((I/2)*(e + f*x)))^(2*m 
)*(a*(1 + Cos[e + f*x]))^m*((C*Hypergeometric2F1[-2 - m, -2*m, -1 - m, -E^ 
(I*(e + f*x))])/(E^(I*(2*e + f*(2 + m)*x))*(2 + m)) + (2*B*Hypergeometric2 
F1[-1 - m, -2*m, -m, -E^(I*(e + f*x))])/(E^(I*(e + f*(1 + m)*x))*(1 + m)) 
+ (2*B*E^(I*(e - f*(-1 + m)*x))*Hypergeometric2F1[1 - m, -2*m, 2 - m, -E^( 
I*(e + f*x))])/(-1 + m) + (C*E^((2*I)*e - I*f*(-2 + m)*x)*Hypergeometric2F 
1[2 - m, -2*m, 3 - m, -E^(I*(e + f*x))])/(-2 + m) + (4*A*Hypergeometric2F1 
[-2*m, -m, 1 - m, -E^(I*(e + f*x))])/(E^(I*f*m*x)*m) + (2*C*Hypergeometric 
2F1[-2*m, -m, 1 - m, -E^(I*(e + f*x))])/(E^(I*f*m*x)*m)))/((1 + E^(I*(e + 
f*x)))^(2*m)*f*Cos[(e + f*x)/2]^(2*m))
 
3.4.83.3 Rubi [A] (verified)

Time = 0.72 (sec) , antiderivative size = 185, normalized size of antiderivative = 1.01, number of steps used = 8, number of rules used = 8, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.242, Rules used = {3042, 3502, 3042, 3230, 3042, 3131, 3042, 3130}

Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.

\(\displaystyle \int (a \cos (e+f x)+a)^m \left (A+B \cos (e+f x)+C \cos ^2(e+f x)\right ) \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \left (a \sin \left (e+f x+\frac {\pi }{2}\right )+a\right )^m \left (A+B \sin \left (e+f x+\frac {\pi }{2}\right )+C \sin \left (e+f x+\frac {\pi }{2}\right )^2\right )dx\)

\(\Big \downarrow \) 3502

\(\displaystyle \frac {\int (\cos (e+f x) a+a)^m (a (C (m+1)+A (m+2))-a (C-B (m+2)) \cos (e+f x))dx}{a (m+2)}+\frac {C \sin (e+f x) (a \cos (e+f x)+a)^{m+1}}{a f (m+2)}\)

\(\Big \downarrow \) 3042

\(\displaystyle \frac {\int \left (\sin \left (e+f x+\frac {\pi }{2}\right ) a+a\right )^m \left (a (C (m+1)+A (m+2))-a (C-B (m+2)) \sin \left (e+f x+\frac {\pi }{2}\right )\right )dx}{a (m+2)}+\frac {C \sin (e+f x) (a \cos (e+f x)+a)^{m+1}}{a f (m+2)}\)

\(\Big \downarrow \) 3230

\(\displaystyle \frac {\frac {a \left (A \left (m^2+3 m+2\right )+B m (m+2)+C \left (m^2+m+1\right )\right ) \int (\cos (e+f x) a+a)^mdx}{m+1}-\frac {a (C-B (m+2)) \sin (e+f x) (a \cos (e+f x)+a)^m}{f (m+1)}}{a (m+2)}+\frac {C \sin (e+f x) (a \cos (e+f x)+a)^{m+1}}{a f (m+2)}\)

\(\Big \downarrow \) 3042

\(\displaystyle \frac {\frac {a \left (A \left (m^2+3 m+2\right )+B m (m+2)+C \left (m^2+m+1\right )\right ) \int \left (\sin \left (e+f x+\frac {\pi }{2}\right ) a+a\right )^mdx}{m+1}-\frac {a (C-B (m+2)) \sin (e+f x) (a \cos (e+f x)+a)^m}{f (m+1)}}{a (m+2)}+\frac {C \sin (e+f x) (a \cos (e+f x)+a)^{m+1}}{a f (m+2)}\)

\(\Big \downarrow \) 3131

\(\displaystyle \frac {\frac {a \left (A \left (m^2+3 m+2\right )+B m (m+2)+C \left (m^2+m+1\right )\right ) (\cos (e+f x)+1)^{-m} (a \cos (e+f x)+a)^m \int (\cos (e+f x)+1)^mdx}{m+1}-\frac {a (C-B (m+2)) \sin (e+f x) (a \cos (e+f x)+a)^m}{f (m+1)}}{a (m+2)}+\frac {C \sin (e+f x) (a \cos (e+f x)+a)^{m+1}}{a f (m+2)}\)

\(\Big \downarrow \) 3042

\(\displaystyle \frac {\frac {a \left (A \left (m^2+3 m+2\right )+B m (m+2)+C \left (m^2+m+1\right )\right ) (\cos (e+f x)+1)^{-m} (a \cos (e+f x)+a)^m \int \left (\sin \left (e+f x+\frac {\pi }{2}\right )+1\right )^mdx}{m+1}-\frac {a (C-B (m+2)) \sin (e+f x) (a \cos (e+f x)+a)^m}{f (m+1)}}{a (m+2)}+\frac {C \sin (e+f x) (a \cos (e+f x)+a)^{m+1}}{a f (m+2)}\)

\(\Big \downarrow \) 3130

\(\displaystyle \frac {\frac {a 2^{m+\frac {1}{2}} \left (A \left (m^2+3 m+2\right )+B m (m+2)+C \left (m^2+m+1\right )\right ) \sin (e+f x) (\cos (e+f x)+1)^{-m-\frac {1}{2}} (a \cos (e+f x)+a)^m \operatorname {Hypergeometric2F1}\left (\frac {1}{2},\frac {1}{2}-m,\frac {3}{2},\frac {1}{2} (1-\cos (e+f x))\right )}{f (m+1)}-\frac {a (C-B (m+2)) \sin (e+f x) (a \cos (e+f x)+a)^m}{f (m+1)}}{a (m+2)}+\frac {C \sin (e+f x) (a \cos (e+f x)+a)^{m+1}}{a f (m+2)}\)

input
Int[(a + a*Cos[e + f*x])^m*(A + B*Cos[e + f*x] + C*Cos[e + f*x]^2),x]
 
output
(C*(a + a*Cos[e + f*x])^(1 + m)*Sin[e + f*x])/(a*f*(2 + m)) + (-((a*(C - B 
*(2 + m))*(a + a*Cos[e + f*x])^m*Sin[e + f*x])/(f*(1 + m))) + (2^(1/2 + m) 
*a*(B*m*(2 + m) + C*(1 + m + m^2) + A*(2 + 3*m + m^2))*(1 + Cos[e + f*x])^ 
(-1/2 - m)*(a + a*Cos[e + f*x])^m*Hypergeometric2F1[1/2, 1/2 - m, 3/2, (1 
- Cos[e + f*x])/2]*Sin[e + f*x])/(f*(1 + m)))/(a*(2 + m))
 

3.4.83.3.1 Defintions of rubi rules used

rule 3042
Int[u_, x_Symbol] :> Int[DeactivateTrig[u, x], x] /; FunctionOfTrigOfLinear 
Q[u, x]
 

rule 3130
Int[((a_) + (b_.)*sin[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Simp[(-2^(n + 
 1/2))*a^(n - 1/2)*b*(Cos[c + d*x]/(d*Sqrt[a + b*Sin[c + d*x]]))*Hypergeome 
tric2F1[1/2, 1/2 - n, 3/2, (1/2)*(1 - b*(Sin[c + d*x]/a))], x] /; FreeQ[{a, 
 b, c, d, n}, x] && EqQ[a^2 - b^2, 0] &&  !IntegerQ[2*n] && GtQ[a, 0]
 

rule 3131
Int[((a_) + (b_.)*sin[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Simp[a^IntPar 
t[n]*((a + b*Sin[c + d*x])^FracPart[n]/(1 + (b/a)*Sin[c + d*x])^FracPart[n] 
)   Int[(1 + (b/a)*Sin[c + d*x])^n, x], x] /; FreeQ[{a, b, c, d, n}, x] && 
EqQ[a^2 - b^2, 0] &&  !IntegerQ[2*n] &&  !GtQ[a, 0]
 

rule 3230
Int[((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*sin[(e_.) + 
(f_.)*(x_)]), x_Symbol] :> Simp[(-d)*Cos[e + f*x]*((a + b*Sin[e + f*x])^m/( 
f*(m + 1))), x] + Simp[(a*d*m + b*c*(m + 1))/(b*(m + 1))   Int[(a + b*Sin[e 
 + f*x])^m, x], x] /; FreeQ[{a, b, c, d, e, f, m}, x] && NeQ[b*c - a*d, 0] 
&& EqQ[a^2 - b^2, 0] &&  !LtQ[m, -2^(-1)]
 

rule 3502
Int[((a_.) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_.)*((A_.) + (B_.)*sin[(e_.) 
+ (f_.)*(x_)] + (C_.)*sin[(e_.) + (f_.)*(x_)]^2), x_Symbol] :> Simp[(-C)*Co 
s[e + f*x]*((a + b*Sin[e + f*x])^(m + 1)/(b*f*(m + 2))), x] + Simp[1/(b*(m 
+ 2))   Int[(a + b*Sin[e + f*x])^m*Simp[A*b*(m + 2) + b*C*(m + 1) + (b*B*(m 
 + 2) - a*C)*Sin[e + f*x], x], x], x] /; FreeQ[{a, b, e, f, A, B, C, m}, x] 
 &&  !LtQ[m, -1]
 
3.4.83.4 Maple [F]

\[\int \left (a +\cos \left (f x +e \right ) a \right )^{m} \left (A +\cos \left (f x +e \right ) B +C \left (\cos ^{2}\left (f x +e \right )\right )\right )d x\]

input
int((a+cos(f*x+e)*a)^m*(A+cos(f*x+e)*B+C*cos(f*x+e)^2),x)
 
output
int((a+cos(f*x+e)*a)^m*(A+cos(f*x+e)*B+C*cos(f*x+e)^2),x)
 
3.4.83.5 Fricas [F]

\[ \int (a+a \cos (e+f x))^m \left (A+B \cos (e+f x)+C \cos ^2(e+f x)\right ) \, dx=\int { {\left (C \cos \left (f x + e\right )^{2} + B \cos \left (f x + e\right ) + A\right )} {\left (a \cos \left (f x + e\right ) + a\right )}^{m} \,d x } \]

input
integrate((a+a*cos(f*x+e))^m*(A+B*cos(f*x+e)+C*cos(f*x+e)^2),x, algorithm= 
"fricas")
 
output
integral((C*cos(f*x + e)^2 + B*cos(f*x + e) + A)*(a*cos(f*x + e) + a)^m, x 
)
 
3.4.83.6 Sympy [F]

\[ \int (a+a \cos (e+f x))^m \left (A+B \cos (e+f x)+C \cos ^2(e+f x)\right ) \, dx=\int \left (a \left (\cos {\left (e + f x \right )} + 1\right )\right )^{m} \left (A + B \cos {\left (e + f x \right )} + C \cos ^{2}{\left (e + f x \right )}\right )\, dx \]

input
integrate((a+a*cos(f*x+e))**m*(A+B*cos(f*x+e)+C*cos(f*x+e)**2),x)
 
output
Integral((a*(cos(e + f*x) + 1))**m*(A + B*cos(e + f*x) + C*cos(e + f*x)**2 
), x)
 
3.4.83.7 Maxima [F]

\[ \int (a+a \cos (e+f x))^m \left (A+B \cos (e+f x)+C \cos ^2(e+f x)\right ) \, dx=\int { {\left (C \cos \left (f x + e\right )^{2} + B \cos \left (f x + e\right ) + A\right )} {\left (a \cos \left (f x + e\right ) + a\right )}^{m} \,d x } \]

input
integrate((a+a*cos(f*x+e))^m*(A+B*cos(f*x+e)+C*cos(f*x+e)^2),x, algorithm= 
"maxima")
 
output
integrate((C*cos(f*x + e)^2 + B*cos(f*x + e) + A)*(a*cos(f*x + e) + a)^m, 
x)
 
3.4.83.8 Giac [F]

\[ \int (a+a \cos (e+f x))^m \left (A+B \cos (e+f x)+C \cos ^2(e+f x)\right ) \, dx=\int { {\left (C \cos \left (f x + e\right )^{2} + B \cos \left (f x + e\right ) + A\right )} {\left (a \cos \left (f x + e\right ) + a\right )}^{m} \,d x } \]

input
integrate((a+a*cos(f*x+e))^m*(A+B*cos(f*x+e)+C*cos(f*x+e)^2),x, algorithm= 
"giac")
 
output
integrate((C*cos(f*x + e)^2 + B*cos(f*x + e) + A)*(a*cos(f*x + e) + a)^m, 
x)
 
3.4.83.9 Mupad [F(-1)]

Timed out. \[ \int (a+a \cos (e+f x))^m \left (A+B \cos (e+f x)+C \cos ^2(e+f x)\right ) \, dx=\int {\left (a+a\,\cos \left (e+f\,x\right )\right )}^m\,\left (C\,{\cos \left (e+f\,x\right )}^2+B\,\cos \left (e+f\,x\right )+A\right ) \,d x \]

input
int((a + a*cos(e + f*x))^m*(A + B*cos(e + f*x) + C*cos(e + f*x)^2),x)
 
output
int((a + a*cos(e + f*x))^m*(A + B*cos(e + f*x) + C*cos(e + f*x)^2), x)